<?php
include('../resource/db/db.php');
session_start();

if (!isset($_COOKIE['role']) || $_COOKIE['role'] != 'admin') {
    header("Location: ../main/login.php");
    exit();
}

if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['feedback_id'])) {
    $feedback_id = $_GET['feedback_id'];

    $sql = "UPDATE feedback SET is_deleted=TRUE WHERE feedback_id=?";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param("i", $feedback_id);

    if ($stmt->execute()) {
        echo "反馈已删除";
        header("Location: manage-feedback.php");
        exit();
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }

    $stmt->close();
}

$conn->close();
?>
